package suanfa;

import com.alibaba.fastjson.JSONObject;

/**
 * 冒泡排序
 */
public class BubbleSort {
    public static void main(String[] args) {
        int[] array = {4,7,5,9};
        int len = array.length;
      for (int i=0 ;i<len-1; i++ ){
          for (int j=0 ; j<len-1-i ;j++){
              if (array[j] > array[j+i]){
                  int temp;
                  temp= array[j];
                  array[j] = array[j+1];
                  array[j+i] = temp;
              }
          }
      }
        System.out.printf(JSONObject.toJSONString(array));
    }
}
